import { createI18n, I18nOptions } from 'vue-i18n'
// import { store } from '@/store'
// import { useAppStore } from '@/store/index'
import 'dayjs/locale/zh-cn'

import zhCnLocale from '@/language/package/zh-cn'   //中文翻译包
import enLocale from '@/language/package/en'        //英文翻译包
import jaLocale from '@/language/package/ja'        //日语翻译包

const messages = {
    'zh': {
        ...zhCnLocale,
        // ...siphonI18n('zh-cn')
    },
    'en': {
        ...enLocale,
        // ...siphonI18n('en')
    },
    'ja':{
        ...jaLocale,
        // ...siphonI18n('ja')
    }
}

const i18n = createI18n({
    legacy: false, // 如果想在composition api中使用需要设置为false
    locale: localStorage.getItem('lang')||'en',
    // TODO: Type instantiation is excessively deep and possibly infinite.  https://github.com/intlify/vue-i18n-next/issues/1119
    messages: messages as I18nOptions['messages'],
    globalInjection: true // 如果设置true, $t() 函数将注册到全局
})

export default i18n
